package com.javabase.y2022.m04.day0428.v02;

/**
 * @descriptions: Solution
 * @author: Tom
 * @date: 2022/4/28 下午 07:48
 * @version: 1.0
 */
public class Solution {
    public static void main(String[] args) {

    }

    public int[] sortArrayByParity(int[] nums) {
        int L = 0, R = nums.length - 1;
        while(L < R){
            while(L < R && nums[L] % 2 == 0){
                L++;
            }
            while(L < R && nums[R] % 2 == 1){
                R--;
            }
            int tmp = nums[L];
            nums[L] = nums[R];
            nums[R] = tmp;
        }
        return nums;
    }
}
